#ifndef POSIX_MSG_SERVER_H
#define POSIX_MSG_SERVER_H

#include <string>
#include <fcntl.h>
#include <sys/stat.h>
#include <mqueue.h>
#include <functional>
#include <pthread.h>
#include <thread>

class POSIX_MsgServer
{
  public:
    POSIX_MsgServer(const char* msgname);
    virtual ~POSIX_MsgServer();
    void BootReceive(std::function<void(std::string && recData)> func);
    void SendData(const std::string & sendData);
  private:
    pthread_t threadID;
    std::thread receiveThread;
    mqd_t id;
    char* receiveBuf;
    int bufsize;
    std::function<void(std::string && recData)> funcReceiveCallback;
};

#endif
